package com.google.zxing.pdf417.decoder;

import com.google.zxing.NotFoundException;
import com.google.zxing.ResultPoint;
import com.google.zxing.common.BitMatrix;

final class BoundingBox
{
  private ResultPoint bottomLeft;
  private ResultPoint bottomRight;
  private BitMatrix image;
  private int maxX;
  private int maxY;
  private int minX;
  private int minY;
  private ResultPoint topLeft;
  private ResultPoint topRight;

  BoundingBox(BitMatrix paramBitMatrix, ResultPoint paramResultPoint1, ResultPoint paramResultPoint2, ResultPoint paramResultPoint3, ResultPoint paramResultPoint4)
    throws NotFoundException
  {
    if (((paramResultPoint1 == null) && (paramResultPoint3 == null)) || ((paramResultPoint2 == null) && (paramResultPoint4 == null)) || ((paramResultPoint1 != null) && (paramResultPoint2 == null)) || ((paramResultPoint3 != null) && (paramResultPoint4 == null)))
      throw NotFoundException.getNotFoundInstance();
    init(paramBitMatrix, paramResultPoint1, paramResultPoint2, paramResultPoint3, paramResultPoint4);
  }

  BoundingBox(BoundingBox paramBoundingBox)
  {
    init(paramBoundingBox.image, paramBoundingBox.topLeft, paramBoundingBox.bottomLeft, paramBoundingBox.topRight, paramBoundingBox.bottomRight);
  }

  private void calculateMinMaxValues()
  {
    if (this.topLeft == null)
    {
      this.topLeft = new ResultPoint(0.0F, this.topRight.getY());
      this.bottomLeft = new ResultPoint(0.0F, this.bottomRight.getY());
    }
    while (true)
    {
      this.minX = ((int)Math.min(this.topLeft.getX(), this.bottomLeft.getX()));
      this.maxX = ((int)Math.max(this.topRight.getX(), this.bottomRight.getX()));
      this.minY = ((int)Math.min(this.topLeft.getY(), this.topRight.getY()));
      this.maxY = ((int)Math.max(this.bottomLeft.getY(), this.bottomRight.getY()));
      return;
      if (this.topRight == null)
      {
        this.topRight = new ResultPoint(-1 + this.image.getWidth(), this.topLeft.getY());
        this.bottomRight = new ResultPoint(-1 + this.image.getWidth(), this.bottomLeft.getY());
      }
    }
  }

  private void init(BitMatrix paramBitMatrix, ResultPoint paramResultPoint1, ResultPoint paramResultPoint2, ResultPoint paramResultPoint3, ResultPoint paramResultPoint4)
  {
    this.image = paramBitMatrix;
    this.topLeft = paramResultPoint1;
    this.bottomLeft = paramResultPoint2;
    this.topRight = paramResultPoint3;
    this.bottomRight = paramResultPoint4;
    calculateMinMaxValues();
  }

  static BoundingBox merge(BoundingBox paramBoundingBox1, BoundingBox paramBoundingBox2)
    throws NotFoundException
  {
    if (paramBoundingBox1 == null)
      return paramBoundingBox2;
    if (paramBoundingBox2 == null)
      return paramBoundingBox1;
    return new BoundingBox(paramBoundingBox1.image, paramBoundingBox1.topLeft, paramBoundingBox1.bottomLeft, paramBoundingBox2.topRight, paramBoundingBox2.bottomRight);
  }

  BoundingBox addMissingRows(int paramInt1, int paramInt2, boolean paramBoolean)
    throws NotFoundException
  {
    Object localObject1 = this.topLeft;
    Object localObject2 = this.bottomLeft;
    Object localObject3 = this.topRight;
    Object localObject4 = this.bottomRight;
    ResultPoint localResultPoint3;
    ResultPoint localResultPoint4;
    label81: ResultPoint localResultPoint1;
    label95: ResultPoint localResultPoint2;
    if (paramInt1 > 0)
    {
      if (paramBoolean)
      {
        localResultPoint3 = this.topLeft;
        int j = (int)localResultPoint3.getY() - paramInt1;
        if (j < 0)
          j = 0;
        localResultPoint4 = new ResultPoint(localResultPoint3.getX(), j);
        if (!paramBoolean)
          break label186;
        localObject1 = localResultPoint4;
      }
    }
    else if (paramInt2 > 0)
    {
      if (!paramBoolean)
        break label193;
      localResultPoint1 = this.bottomLeft;
      int i = paramInt2 + (int)localResultPoint1.getY();
      if (i >= this.image.getHeight())
        i = -1 + this.image.getHeight();
      localResultPoint2 = new ResultPoint(localResultPoint1.getX(), i);
      if (!paramBoolean)
        break label202;
      localObject2 = localResultPoint2;
    }
    while (true)
    {
      calculateMinMaxValues();
      return new BoundingBox(this.image, (ResultPoint)localObject1, (ResultPoint)localObject2, (ResultPoint)localObject3, (ResultPoint)localObject4);
      localResultPoint3 = this.topRight;
      break;
      label186: localObject3 = localResultPoint4;
      break label81;
      label193: localResultPoint1 = this.bottomRight;
      break label95;
      label202: localObject4 = localResultPoint2;
    }
  }

  ResultPoint getBottomLeft()
  {
    return this.bottomLeft;
  }

  ResultPoint getBottomRight()
  {
    return this.bottomRight;
  }

  int getMaxX()
  {
    return this.maxX;
  }

  int getMaxY()
  {
    return this.maxY;
  }

  int getMinX()
  {
    return this.minX;
  }

  int getMinY()
  {
    return this.minY;
  }

  ResultPoint getTopLeft()
  {
    return this.topLeft;
  }

  ResultPoint getTopRight()
  {
    return this.topRight;
  }
}

/* Location:           C:\Users\user\Desktop\dd28_pcdd720\classes_dex2jar.jar
 * Qualified Name:     com.google.zxing.pdf417.decoder.BoundingBox
 * JD-Core Version:    0.6.2
 */